package com.cheer.controller;

import com.cheer.common.Result;
import com.cheer.dto.OaOpinionAddDTO;
import com.cheer.service.AuthService;
import com.cheer.service.OaOpinionService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpSession;
import javax.validation.Valid;

/**
 * @author cheer
 */
@RestController
@RequestMapping("/opinion")
public class OaOpinionController {

    @Autowired
    private OaOpinionService oaOpinionService;

    @Autowired
    private AuthService authService;

    @ApiOperation("提交反馈")
    @PostMapping("/add")
    public Result add(@RequestBody @Valid OaOpinionAddDTO opinionAddDTO, HttpSession session) {
        oaOpinionService.add(authService.getUserId(session), opinionAddDTO.getSuggest());
        return Result.success();
    }

}
